﻿@model IEnumerable<ProjectManagement.Domain.Entities.User>
@using ProjectManagement.Web.HtmlHelp;
@{
    ViewBag.Title = "用户管理";
	Layout = null;
}

<link href="@Url.Content("~/Content/images/right.css")" rel="stylesheet" type="text/css" />
<link href="../../Content/themes/base/jquery.ui.all.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery-ui-1.8.22.min.js" type="text/javascript"></script>
<script type="text/javascript">
	var message="@TempData["Message"]";
	if(message)
	{
		alert(message);
	}
	function ReturnTo(obj)
	{
		var id=document.getElementById("textfield").value;
		location="/SysManage/UserList/?pageIndex="+parseInt(id);
	}

	$(function() {
		$( "input:submit, a, button", ".demo" ).button();
	});
</script>
<div class="demo">
<div>
@using (Html.BeginForm("UserList","SysManage",FormMethod.Post))
{
	<p>
		<label for="name">用户名：</label><input type="text" id="name" name="name"/> &nbsp;&nbsp;&nbsp;&nbsp;
		<label for="realname">真实姓名：</label><input type="text" id="realname" name="realname"/>&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="submit" value="查询"/>&nbsp;&nbsp;&nbsp;&nbsp;
		@Html.ActionLink("新增用户", "AddUsers", "SysManage") &nbsp;&nbsp;&nbsp;&nbsp;
	</p>
}
</div>
<!--使用table用以实现中间内容的自适应宽度-->
<table width="100%" border="0" cellpadding="0" cellspacing="0" id="Box">

    <td valign="middle" class="l_m_bg">&nbsp;&nbsp;</td>
    <td valign="top" class="view">
		<div id="View"> 
        <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="b5d6e6"  >
          <tr class="tbg">
            <td width="5%"><input type="checkbox" name="checkbox" value="checkbox" /></td>
            <td width="3%">用户名</td>
            <td width="5%">真实姓名</td>
            <td width="2%">密码</td>
            <td width="5%">性别</td>
            <td width="14%">允许登陆</td>
			<td width="10%">省市</td>
			<td width="18%">地址</td>
			<td >操作</td>
          </tr>
          @foreach (var item in Model)
          {
          <tr class="lbg">
            <td class="tc"><input type="checkbox" name="checkbox2" value="checkbox" />@item.ID</td>
            <td class="tc">@item.UserName</td>
            <td>@item.RealName</td>
            <td>@item.Password</td>
            <td>@Html.SexHelper(item.Sex)</td> 
			<td>@Html.AllowLogin(item.Allowed)</td>
			<td>@Html.ReturnPro(item.Provience) @Html.ReturnCity(item.City)</td>
			<td>@item.Address</td>
            <td>
				@Html.ActionLink("编辑", "EditUsers", "SysManage", new { Id = @item.ID },null)|
				@Html.ActionLink("详情", "UserDetails", "SysManage", new { Id = @item.ID },null)|
				@Html.ActionLink("分配角色", "GiveRole", "SysManage", new { uid = @item.ID },null) |
				@Html.ActionLink("登陆控制", "ForbidUser", "SysManage", new { Id = @item.ID },null) |
				@Html.ActionLink("删除", "DeleteUsers", "SysManage", new { Id = @item.ID },null) 
			</td>
          </tr>
          }          
         </table>
         <div class="pagerno"><div class="info fl">共有 @ViewBag.TotalCount 条记录，当前第 @ViewBag.PageIndex / @ViewBag.PageCount 页</div>
         <div class="fr">
              <a href="/SysManage/UserList/?pageIndex=@ViewBag.PageIndex" class="frist fl"> </a>
              <a href="/SysManage/UserList/?pageIndex=@(ViewBag.PageIndex-1)" class="back fl"> </a>
              <a href="/SysManage/UserList/?pageIndex=@(ViewBag.PageIndex+1)" class="next fl"> </a>
              <a href="/SysManage/UserList/?pageIndex=@(ViewBag.PageCount)" class="last fl"> </a>
			  <div class="gof fl">转到第 <input name="textfield" id="textfield" type="text" value="" size="4" style="height:12px; width:20px; border:1px solid #999999;" /> 页 </div>
              <a href="javascript:ReturnTo();" class="go fl"> </a>
         </div>
		 <div class="clear"></div>
         </div>
    </div>
	</td>
    <td class="r_m_bg">&nbsp;</td>
  </tr>
  <tr>
    <td valign="bottom" class="l_b_bg bbg"> </td>
    <td class="bottom bbg"> </td>
    <td valign="bottom" class="r_b_bg bbg"> </td>
  </tr>
</table>
</div>